/*
 * StateSplash.cpp
 *
 *  Created on: 07/06/2013
 *      Author: vitor
 */

#include "StateSplash.h"

StateSplash::StateSplash() {

}

StateSplash::~StateSplash() {
	unload();
}

void StateSplash::input() {
	if (InputManager::getInstance()->isKeyDown(SDLK_RETURN))
		nextState = SDLBase::STATEGAME;
	if (InputManager::getInstance()->QuitGame()
			|| InputManager::getInstance()->isKeyDown(SDLK_ESCAPE))
		nextState = SDLBase::STATEQUIT;
}

int StateSplash::update(double dt) {
	return nextState;
}

void StateSplash::render() {
	background->render(0, 0, false);
	startGameText->render(0, 0, true);
}

void StateSplash::load(StateArgs arguments) {

	this->arguments = arguments;

	SDL_Color color;
	color.r = 180;
	color.g = 180;
	color.b = 255;

	nextState = SDLBase::STATENOCHANGE;

	startGameText = new Text("../ttf/DiabloLight.ttf",
			"Pressione 'Enter' para iniciar o jogo", 22, 0, color, 400, 250);
	music = new Music("../snd/stateMenu.mp3");
	background = new Sprite("../gfx/stateMenu.jpg");

	music->play(-1);

}

StateArgs StateSplash::unload() {
	music->stop();

	delete (music);
	delete (startGameText);
	delete (background);

	return StateArgs();
}
